/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Bean;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.text.ParseException;
import java.util.StringTokenizer;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.application.FacesMessage;  
import javax.faces.context.FacesContext;  
import javax.faces.event.ActionEvent;

/**
 *
 * @author miguel
 */
@ManagedBean(name="personBean")
@RequestScoped
public class PersonBean {  
  
    private String firstname;  
      
    private String surname;  
  
    public String getFirstname() {  
        return firstname;  
    }  
    public void setFirstname(String firstname) {  
        this.firstname = firstname;  
    }  
  
    public String getSurname() {  
        return surname;  
    }  
    public void setSurname(String surname) {  
        this.surname = surname;  
    }  
      
    public void savePerson(ActionEvent actionEvent){  
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(getip()));  
        
    }
    
    public String getip() {
        try {
            InetAddress thisIp = InetAddress.getLocalHost();
            String ip = thisIp.getLocalHost().toString();
            return ip;
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }
    
    
}
